import "@site/src/languages/highlight";

# Keyboard

**Description:**

&emsp;&emsp;An interface for handling keyboard inputs.

## Keyboard.KeyName

**Type:** Enumeration.

**Description:**

&emsp;&emsp;Enumeration for defining the keys.

**Signature:**
```tl
enum KeyName
	"Return"
	"Escape"
	"BackSpace"
	"Tab"
	"Space"
	"!"
	"\""
	"#"
	"%"
	"$"
	"&"
	"'"
	"("
	")"
	"*"
	"+"
	","
	"-"
	"."
	"/"
	"1"
	"2"
	"3"
	"4"
	"5"
	"6"
	"7"
	"8"
	"9"
	"0"
	":"
	";"
	"<"
	"="
	">"
	"?"
	"@"
	"["
	"\\"
	"]"
	"^"
	"_"
	"`"
	"A"
	"B"
	"C"
	"D"
	"E"
	"F"
	"G"
	"H"
	"I"
	"J"
	"K"
	"L"
	"M"
	"N"
	"O"
	"P"
	"Q"
	"R"
	"S"
	"T"
	"U"
	"V"
	"W"
	"X"
	"Y"
	"Z"
	"Delete"
	"CapsLock"
	"F1"
	"F2"
	"F3"
	"F4"
	"F5"
	"F6"
	"F7"
	"F8"
	"F9"
	"F10"
	"F11"
	"F12"
	"PrintScreen"
	"ScrollLock"
	"Pause"
	"Insert"
	"Home"
	"PageUp"
	"Delete"
	"End"
	"PageDown"
	"Right"
	"Left"
	"Down"
	"Up"
	"Application"
	"LCtrl"
	"LShift"
	"LAlt"
	"LGui"
	"RCtrl"
	"RShift"
	"RAlt"
	"RGui"
end
```

## isKeyDown

**Type:** Function.

**Description:**

&emsp;&emsp;Check whether a key is pressed down in current frame.

**Signature:**
```tl
isKeyDown: function(self: Keyboard, name: KeyName): boolean
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| name | KeyName | The name of the key to check. |

**Returns:**

| Return Type | Description |
| --- | --- |
| boolean | Whether the key is pressed down. |

## isKeyUp

**Type:** Function.

**Description:**

&emsp;&emsp;Check whether a key is released in current frame.

**Signature:**
```tl
isKeyUp: function(self: Keyboard, name: KeyName): boolean
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| name | KeyName | The name of the key to check. |

**Returns:**

| Return Type | Description |
| --- | --- |
| boolean | Whether the key is released. |

## isKeyPressed

**Type:** Function.

**Description:**

&emsp;&emsp;Check whether a key is in pressed state.

**Signature:**
```tl
isKeyPressed: function(self: Keyboard, name: KeyName): boolean
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| name | KeyName | The name of the key to check. |

**Returns:**

| Return Type | Description |
| --- | --- |
| boolean | Whether the key is in pressed state. |

## updateIMEPosHint

**Type:** Function.

**Description:**

&emsp;&emsp;Update the input method editor (IME) position hint.

**Signature:**
```tl
updateIMEPosHint: function(self: Keyboard, winPos: Vec2)
```

**Parameters:**

| Parameter | Type | Description |
| --- | --- | --- |
| winPos | Vec2 | The position of the keyboard window. |